import { dev } from "./env"

export const Request = ({url,method="get",data={}})=>{
	let _url =  `${dev.baseUrl}${url}`
	return new Promise((resolve,reject)=>{
		wx.showLoading({
		  title: '加载中~~~~',
		})
		wx.request({
		  url: _url,
		  data:data,
		  method:method,
		  header:{
			'content-type':'application/x-www-form-urlencoded'
		  },
		  success:res=>{               
			   resolve(res.data);
			   wx.hideLoading()
		  },
		  fail:err=>{
			reject(err)
		  }
		})
	})
}